package com.yhf.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yhf.dto.BranchDto;
import com.yhf.dto.TaskPlanDto;
import com.yhf.model.Taskplan;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

@Mapper
public interface TaskPlanMapper extends BaseMapper<Taskplan> {
    @Results(id = "taskplan",value = {
            @Result(column = "tid",property = "tid"),
            @Result(column = "tname",property = "tname"),
            @Result(column = "starttime",property = "starttime"),
            @Result(column = "endtime",property = "endtime"),
            @Result(column = "updatetime",property = "updatetime"),
            @Result(column = "status",property = "status"),
            @Result(column = "bid",property = "branchDto",javaType = BranchDto.class,one =
            @One(select = "com.yhf.mapper.BranchMapper.selectByBid",fetchType = FetchType.EAGER))
    })
    @Select("select * from taskplan ${ew.customSqlSegment}")
    IPage<TaskPlanDto> selectAll(Page<TaskPlanDto> page, @Param(Constants.WRAPPER) QueryWrapper<TaskPlanDto> queryWrapper);
}
